/*
 * @Author: Sam
 * @Date: 2025-04-27 09:19:45
 * @LastEditTime: 2025-10-09 10:59:52
 * @LastEditors: Sam
 */
import { useEffect } from 'react';
import './App.css';
import { Config, DataType, GISViewer } from 'gis-viewer';

function App() {

	useEffect(()=>{
	
		//创建实例
		const gisv = GISViewer.create(document.getElementById('gisv') as HTMLDivElement, {
			mapLayer: {
				type: DataType.TMS_IMAGERY,
				name: '全球默认影像',
				id: 'global_imagery',
				baseId: 'global_imagery',
				format: 'image/jpg',
				url: Config.DEFAULT_IMAGERY,
				maxLevel: 7,
				minLevel: 5,
			},
		});
		window.gisv = gisv;

		//全可通过 const gisv = await window.gisvDefer.promise 获取gisv示例，避免初始化的时序问题
		window.gisvDefer.resolve(window.gisv);
		
	}, []);
	return <div id="root" className='container'>
		<div className='gisv' id="gisv"></div>
	</div>
}

export default App;

